package org.example.test_03.Controller;

import org.example.test_03.Domian.Ad;
import org.example.test_03.Domian.ReturnData;
import org.example.test_03.Service.AdService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author lands
 * @Date 2024/8/14 10:32
 * @Description 轮播图相关接口
 */
@RestController
@RequestMapping("/banner")  //不能用ad作为路径
public class AdController {
    @Resource
    AdService adService;

    @PostMapping("/deleteAd")
    ReturnData delete(@RequestBody Ad ad){
        return adService.delete(ad.getId());
    }

    @GetMapping("/list")
    public ReturnData select(String name,String content){
        return  adService.select(name,content);
    }

    @PostMapping("/addAd")
    public ReturnData addAd(@RequestBody Ad ad){
        return  adService.addAd(ad);
    }
    @PostMapping("/updateAd")
    public ReturnData updateAd(@RequestBody Ad ad){
        return  adService.updateAd(ad);
    }
}
